import org.junit.*;
import static org.junit.Assert.*;
import com.thoughtworks.selenium.*;

import org.junit.Before;

public class CredoTest3 {

	Selenium testDriver;
	@Before
	public void setUp() throws Exception {
		testDriver = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.credomobile.com");
		testDriver.start();
	}
	
	@Test
	public void thirdTestCase()
	{
		testDriver.open("/");
		testDriver.windowMaximize();
		testDriver.mouseOver("link=Phones");
		clickAndLoadNextPage("link=all phones");
		
		clickAndLoadNextPage("//div[@class='phoneInfo']/div[4]/a");
		
		testDriver.type("//div[@class='zipField']/input", "95134");
		clickAndLoadNextPage("//div[@class='zipField']/input[2]");
		clickAndLoadNextPage("link=famPlansTab");
		clickAndLoadNextPage("//DIV[@id='individualPlans']/TABLE/TBODY/TR[1]/TD[6]/A");
		
		clickAndLoadNextPage("//DIV[@id='versionA']/DIV[2]/DIV[2]/DIV[4]/A");
		clickAndLoadNextPage("//TABLE[@id='cartDetails']/TBODY/tr[6]/td/div/a");
		
		clickAndLoadNextPage("link=Add to Cart");
		clickAndLoadNextPage("link=Add to Cart");
	    clickAndLoadNextPage("//div[@id='mainContentWrapper']/div[2]/div[2]/div[5]/fieldset[1]/div[1]/input");
		
		clickAndLoadNextPage("//div[@id='mainContentWrapper']/div[2]/div[2]/div[5]/fieldset[2]/div[1]/input[2]");
		testDriver.typeKeys("//div[@id='mainContentWrapper']/div[2]/div[2]/div[5]/fieldset[2]/div[1]/input[2]", "a");
	    //clickAndLoadNextPage("//div[@class='clearfix']/input/label/input");
	    
	    
		
	}
	
	public void clickAndLoadNextPage(String page)
	{
		testDriver.click(page);
		testDriver.waitForPageToLoad("30000");
	}

	@After
	public void tearDown() throws Exception {
	//testDriver.close();
	}

}